package Feb_14.TestThreadTicket;

public class TestTicket implements Runnable{
    static int tickets = 100;

    @Override
    public void run() {
        while (true){
            if (TestTicket.tickets>0){
                System.out.printf("售票中,剩余票数%d\n",TestTicket.tickets--);
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }else {
                break;
            }
        }
    }
}
